﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:MaxAlarm="clr-namespace:MaxAlarm" xmlns:Pages="clr-namespace:MaxAlarm.Pages"
	xmlns:ViewModels="clr-namespace:MaxAlarm.ViewModels" mc:Ignorable="d"
	x:Class="MaxAlarm.MainWindow"
	x:Name="Window"
	Width="800" Height="600" 
	WindowStyle="None" 
	AllowsTransparency="True"
    Loaded="LoadedWindow"
    DataContext="{DynamicResource ViewModel}"
    Icon="MaxAlarm.ico"
    Background="Transparent"
    ResizeMode="NoResize">
    
    <Window.Resources>
        <ViewModels:MainWindowViewModel x:Key="ViewModel" 
                                        CanRefresh="False"
                                        CanRun="False"
                                        CanShowSettings="True"
                                        PageManager="{StaticResource PagesManager}">
        </ViewModels:MainWindowViewModel>
        
    </Window.Resources>

    <Border Background="Transparent"
		    BorderBrush="White"
		    BorderThickness="1"
		    MouseLeftButtonDown="DragWindow" 
		    SnapsToDevicePixels="True"
            x:Name="MainWindowBorder">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <Border Background="{StaticResource DefaultGlassBrush}"
                     Grid.Row="0">
                <Grid x:Name="TopGrid">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <Canvas Width="24"
				            Height="24"
				            Background="{StaticResource AlarmClock}"
				            Margin="10,10,0,10" />

                    <TextBlock Text="Max alarm"
				               Foreground="White"
				               FontSize="14" 
				               Grid.Column="1"
				               VerticalAlignment="Center"
				               HorizontalAlignment="Center"
				               FontFamily="Segoe UI"
				               FontStretch="Expanded"/>
                    <Grid Grid.Column="3"
                          Margin="0,0,10,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <Button Margin="0,10,0,10"
                                Grid.Column="0"
				                VerticalAlignment="Center"
				                HorizontalAlignment="Center"
				                Style="{StaticResource WindowButtonStyle}"
				                Click="MinimizeWindow">

                            <Canvas Width="12"
					                    Height="12"
					                    Background="{StaticResource MinimizeBrush}"/>
                        </Button>

                        <Button Margin="0,10,0,10"
                                    Grid.Column="1"
				                    VerticalAlignment="Center"
				                    HorizontalAlignment="Center"
				                    Style="{StaticResource WindowButtonStyle}"
				                    Click="MaximizeWindow">

                            <Canvas Width="12"
					                    Height="12"
					                    Background="{StaticResource MaximizeBrush}"/>
                        </Button>

                        <Button Margin="0,10,0,10"
                                    Grid.Column="2"
				                    VerticalAlignment="Center"
				                    HorizontalAlignment="Center"
				                    Style="{StaticResource WindowButtonStyle}"
				                    Click="CloseWindow">

                            <Canvas Width="12"
					                    Height="12"
					                    Background="{StaticResource CloseBrush}"/>
                        </Button>
                    </Grid>

                    <Canvas Background="{StaticResource LineBrush}"
				            Grid.ColumnSpan="4"
				            Height="1"
				            HorizontalAlignment="Stretch"
				            VerticalAlignment="Bottom"
				            Margin="2,0,2,0" />

                </Grid>
            </Border>

            <Border Grid.Row="1" 
                    Background="{StaticResource DefaultGlassBrush}">
                <Grid x:Name="MiddleGrid"
                      Background="Transparent">
                    <Frame Content="{Binding Path=PageManager.CurrentPage, Mode=TwoWay}"
                           Grid.Row="1"
                           NavigationUIVisibility="Hidden"
                           Background="Transparent"/>
                </Grid>
            </Border>
        </Grid>
    </Border>
</Window>